export default {
  totalcount (state) {
    return state.cart.reduce((result, item) => {
      if (item.ischecked === true) {
        result += item.count
      }
      return result
    }, 0)
  },
  totalprice (state) {
    return state.cart.reduce((result, item) => {
      result += item.count * item.price
      return result
    }, 0)
  },
  Allchecked (state) {
    return state.cart.every(item => item.ischecked === true)
  },
  checkprice (state) {
    return state.cart.reduce((result, item) => {
      if (item.ischecked === true) {
        result += item.count * item.price
      }
      return result
    }, 0)
  },
  Alltotal (state) {
    return state.cart.reduce((result, item) => {
      result += item.count
      return result
    }, 0)
  }
}
